<?php
    header("Content-typ:text/html;charset=utf-8");
    include("base.php");
    $username=$_POST['username'];
    $sql = "SELECT*FROM `user`WHERE `username`='$username'";
    $res = $conn->query($sql);
    $row = mysqli_fetch_assoc($res);
    if ($row) {
        echo json_encode(Array(
            'code' => 0,
            'msg' => '注册失败',
            'token' => '9832ijds9h239hoejf0h9239h9eh923i320h'
        ));
    } else {
        echo json_encode(Array(
            'code' => 1,
            'msg' => '注册成功',
            'token' => ''
        ));
    }
?>